//
//  ViewController.swift
//  myapp2
//
//  Created by lanou on 16/10/28.
//  Copyright (c) 2016年 lanou. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
//视图加载完成
    override func viewDidLoad() {
        super.viewDidLoad()
      let  text = UITextField(frame: CGRectMake(10, 50,200, 50))
        text.placeholder = "heshuai"
        text.borderStyle = UITextBorderStyle.RoundedRect
       view.addSubview(text)
        
      let aview = UIView(frame: CGRectMake(50, 100,50, 50))
       aview.backgroundColor = UIColor.blueColor()
        view.addSubview(aview)
//        设置圆形
        aview.layer.cornerRadius = 25
        aview.layer.masksToBounds = true
    
        let btn = UIButton(frame: CGRectMake(10,200, 300, 300))
        btn.backgroundColor = UIColor.redColor()
//        设置背景图片
        let image = UIImage(named: "1.jpg")
        btn.setBackgroundImage(image, forState: .Normal)
        let hightimage = UIImage(named: "paros_logo")
        btn.setBackgroundImage(hightimage, forState: .Highlighted)
//        设置按钮
        btn.setTitle("doglight", forState: .Normal)
        btn.setTitleColor(UIColor.yellowColor() , forState: .Normal)
        view.addSubview(btn)
//        监听按钮,当事件（touchupinside）触发的时候会执行action
        btn.addTarget(self, action: "btnAction:", forControlEvents: .TouchUpInside)
    }
// 按钮监听响应
    
    func btnAction(button:UIButton){
       println("点击类按钮")
    }
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}
/*
  UIView:在ios里面所有你能看到的都是UIView或者其他

*/

